import org.example.Business.studentService;
import org.example.Model.student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;

import java.io.PrintWriter;

@ContextConfiguration("classpath:database-contest.xml")
public class Beantext extends AbstractTestNGSpringContextTests {
    @Autowired
    student stu;
 @Autowired
 studentService service;
    @Test
    public void beantest(){
    stu.setSname("java.ee");
        AssertJUnit.assertNotNull(stu);
    }
    @Test
    public void insert() {
       try{
            stu.setSno("123");
            stu.setSname("张三");
            stu.setSsex("男");
            stu.setSage(30);
            stu.setSdept("MA");
            service.insert(stu);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
@Test
   public void onStudent(){
        try {
            service.addSage(2);
        }catch (Exception e) {
            e.printStackTrace();
        }

    }

}
